﻿namespace NJQuery.Configuration {
	using System.Configuration;
	using System.Diagnostics.CodeAnalysis;

	/// <summary>
	/// Represents a client script element in a configuration file.
	/// </summary>
	public class ClientScript : ConfigurationElement {


		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="ClientScript"/> class.
		/// </summary>
		public ClientScript() { }

		#endregion


		#region Properties

		/// <summary>
		/// Gets or sets the invariant name associated with the client script.
		/// </summary>
		[ConfigurationProperty("name", IsRequired = true, IsKey = true, DefaultValue = "")]
		public virtual string Name {
			get { return this["name"] as string; }
			set { this["name"] = value; }
		}

		/// <summary>
		/// Gets or sets the URL associated with the client script.
		/// A value that starts with <c>./</c> or <c>../</c> will be treated as relative to the appropriate defined client script base URL.
		/// Starting the value with <c>~/</c> will define it relative to the application root.
		/// A value starting with <c>/</c> will be relative to the domain root, and all other values will be relative to the current page.
		/// </summary>
		[ConfigurationProperty("url", IsRequired = true, DefaultValue = "")]
		[SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Justification = "This is for a settings file.")]
		public virtual string Url {
			get { return this["url"] as string; }
			set { this["url"] = value; }
		}

		#endregion


	}

}